﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TLCApp.pulic
{
    public abstract class Cls_Popup
    {
        /// <summary>
        /// 未实现功能弹出提示
        /// </summary>
        public static void MsgNull()
        {
            System.Windows.Forms.MessageBox.Show("此功能尚未实现", "提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Asterisk);
        }

        /// <summary>
        /// 普通提示消息框
        /// </summary>
        /// <param name="MsgStr">消息内容</param>
        public static void MsgBox(string MsgStr)
        {
            System.Windows.Forms.MessageBox.Show(MsgStr, "提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Asterisk);
        }

        /// <summary>
        /// 错误提示消息框
        /// </summary>
        /// <param name="MsgStr">消息内容</param>
        public static void MsgErrBox(string MsgStr)
        {
            System.Windows.Forms.MessageBox.Show(MsgStr, "错误", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
        }

        /// <summary>
        /// 警告提示消息框
        /// </summary>
        /// <param name="MsgStr">消息内容</param>
        public static void MsgWarnBox(string MsgStr)
        {
            System.Windows.Forms.MessageBox.Show(MsgStr, "警告", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
        }

        /// <summary>
        /// 带YES/NO选择的消息框
        /// </summary>
        /// <param name="MsgStr">消息内容</param>
        /// <returns>返回布尔型结果:True表示Yes,False表示N0</returns>
        public static bool MsgYesNoBox(string MsgStr)
        {
            if (System.Windows.Forms.MessageBox.Show(MsgStr, "提示", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Asterisk) == System.Windows.Forms.DialogResult.Yes)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 带YES/NO选择的消息框
        /// 默认选中yes
        /// hwadley 20110125
        /// </summary>
        /// <param name="MsgStr">消息内容</param>
        /// <returns>返回布尔型结果:True表示Yes,False表示N0</returns>
        public static bool MsgYesNoBox_Yes(string MsgStr)
        {
            if (System.Windows.Forms.MessageBox.Show(MsgStr, "提示", System.Windows.Forms.MessageBoxButtons.YesNo,  System.Windows.Forms.MessageBoxIcon.Asterisk ,System.Windows.Forms.MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 带YES/NO/CANCEL选择的消息框
        /// </summary>
        /// <param name="MsgStr">消息内容</param>
        /// <returns>返回数值型结果:0表示Yes,1表示No,2表示Cancel</returns>
        public static int MsgYesNoCancelBox(string MsgStr)
        {
            if (System.Windows.Forms.MessageBox.Show(MsgStr, "提示", System.Windows.Forms.MessageBoxButtons.YesNoCancel, System.Windows.Forms.MessageBoxIcon.Asterisk) == System.Windows.Forms.DialogResult.Yes)
            {
                return 0;
            }
            else if (System.Windows.Forms.MessageBox.Show(MsgStr, "提示", System.Windows.Forms.MessageBoxButtons.YesNoCancel, System.Windows.Forms.MessageBoxIcon.Asterisk) == System.Windows.Forms.DialogResult.No)
            {
                return 1;
            }
            else if (System.Windows.Forms.MessageBox.Show(MsgStr, "提示", System.Windows.Forms.MessageBoxButtons.YesNoCancel, System.Windows.Forms.MessageBoxIcon.Asterisk) == System.Windows.Forms.DialogResult.Cancel)
            {
                return 2;
            }
            else
            {
                return -1;
            }
        }

        
    }
}
